<template>
    <view class="staff-add bg-f5 fullpage-min">
        <u-gap height="20"></u-gap>
        <view class="lump p-20 bg-ff flex-row  jc-between">
            <view style="width: 20%;">类型</view>
            <u-radio-group v-model="value" @change="radioGroupChange">
                <u-radio @change="radioChange" v-for="(item, index) in list" :key="index" :name="item.name"
                    :disabled="item.disabled">
                    {{item.name}}
                </u-radio>
            </u-radio-group>
        </view>
        <input-field borderless type="textarea" fieldalign="right" placeholder="请输入姓名" label="姓名" v-model="form.name"
            autosize>
        </input-field>
        <input-field borderless type="textarea" fieldalign="right" placeholder="请输入联系方式" label="电话" v-model="form.name"
            autosize>
        </input-field>

        <input-field v-if="value=='供应商'" borderless type="textarea" fieldalign="right" placeholder="请输入店名" label="店名"
            v-model="form.name" autosize>
        </input-field>

        <input-field v-if="value=='店员'" borderless type="textarea" fieldalign="right" placeholder="请输入就职时间" label="就职时间"
            v-model="form.name" autosize>
        </input-field>
        <input-field borderless type="textarea" fieldalign="right" placeholder="请输入备注" label="备注" v-model="form.name"
            autosize>
        </input-field>
        <view class="btn-bottom-norma pos-absolute" style="left: 40rpx ;right: 40rpx;bottom: 40rpx;">
            <g-button class="btn-bottom-normal-content" :loading="submitLoading" size="large" type="primary"
                @click="submit">
                确认添加
            </g-button>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                form: {
                    name: ''
                },
                list: [{
                        name: '店员',
                        disabled: false
                    },
                    {
                        name: '供应商',
                        disabled: false
                    }
                ],
                submitLoading:false,
                // u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
                value: '店员',
            }
        },
        methods: {
            radioChange(e) {
                this.value = e
                console.log(e, 1);
            },
            // 选中任一radio时，由radio-group触发
            radioGroupChange(e) {
                // console.log(e,2);
            }
        }
    }
</script>

<style lang="scss" scoped>
    .staff-add {
        .lump {
            border-bottom: 1rpx dashed #eee;
        }
    }
</style>
